#ifndef FIELD
#define FIELD

#include <vector>

#include"Wall.h"
#include "gameElement.h"
//#include "Utils.h"

#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
//#define iw 128
//#define ih 128
//#define tf "Marbre.raw"

#define iw 256
#define ih 256
#define tf "tiles2.raw"

class Field
{
private :

	int height ;
	int width;
	int xSpawn;
	int zSpawn;
	int xExit;
	int zExit;
	int xMinZoneSpawn;
	int xmaxZoneSpawn;
	int zMinZoneSpawn;
	int zMaxZoneSpawn;
	std::vector< std::vector <int>*>* grid;
	std::vector<Wall*> *walls;


public:
	Field(int width, int height, int xSpawn, int zSpawn,
		int xExit, int zExit,int xmaxZoneSpawn,int zMaxZoneSpawn,
		int xMinZoneSpawn,int zMinZoneSpawn);

	virtual ~Field(void);
	static void init();
	static void lectureTexture(char *fichier,int dx,int dy);
	bool isAWall(int x,int z);
	bool isATwistedWall(int x, int z);
	bool isAConcreteWall(int x, int z);
	void display();
	void buildMap ();
	void drawVLineWall(int x,int z, int nbCase);
	void drawHLineWall(int x, int z, int nbCase);
	void drawTWall(int x,int z);
	void creationWall();

	std::vector<std::vector<int>*>* getGrid();
	int getHeight();
	int getWidth();
	int getSpawnX();
	int getSpawnZ();
	int getExitX();
	int getExitZ();
	bool isInSpawnArea(int x,int z);


};

#endif
